TOOL.Category			= "Selling Machine"
TOOL.Name				= "#Sellers"

TOOL.DeviceName			= "Selling Machine"
TOOL.DeviceNamePlural	= "Selling Machines"
TOOL.ClassName			= "stool_seller_machine"

TOOL.DevSelect			= true
TOOL.CCVar_type			= "seller_machine"
TOOL.CCVar_sub_type		= "Seller_Main"
TOOL.CCVar_model		= "models/ce_ls3additional/fusion_generator/fusion_generator_huge.mdl"

TOOL.Limited			= true
TOOL.LimitName			= "stool_seller_machine"
TOOL.Limit				= 5

CAFToolSetup.SetLang("CAF Selling Machine","Creates a machine to sell stuff","Left-Click: Spawn a Machine.  Reload: Remove.")


TOOL.ExtraCCVars = {
	extra_num = 0,
	extra_bool = 0,
}

function TOOL.EnableFunc()
	if not CAF then
		return false;
	end
	if not CAF.GetAddon("Resource Distribution") or not CAF.GetAddon("Resource Distribution").GetStatus() then
		return false;
	end
	return true;
end

function TOOL.ExtraCCVarsCP( tool, panel )
	--panel:CheckBox( "Amount Outputs", "mining_storage_wireamount")
	--panel:CheckBox( "Capacity Outputs", "mining_storage_wirecapacity" )
	panel:AddControl("Label", {Text = "Tip: This is a tip regarding the seller machine", Description = "A Tip"})
end

function TOOL:GetExtraCCVars()
	local Extra_Data = {}
	Extra_Data.extra_num		= self:GetClientNumber("extra_num")
	Extra_Data.extra_bool		= self:GetClientNumber("extra_bool") == 1
	return Extra_Data
end

/*
TOOL.Renamed = {
	class = {
		seller_machine	= "seller_machine"
	},
	type = {
		seller_machine	= "seller_machine"
	},
}
*/

local volumeMul = 1.3
local function price_machine_func(ent,type,sub_type,devinfo,Extra_Data,ent_extras)
	local phys = ent:GetPhysicsObject()
	local maxcap = 100
	if phys:IsValid() and phys.GetVolume then
		maxcap = math.floor((phys:GetVolume()*volumeMul))
	end
	local mass = maxcap/1000
	ent.mass = mass
	local maxhealth = 600
	return mass, maxhealth
end
local function seller_machine_func(ent,type,sub_type,devinfo,Extra_Data,ent_extras)
	local phys = ent:GetPhysicsObject()
	local maxcap = 100
	local rockpercent = 20 --how much of the maxcap can hold rock
	if phys:IsValid() and phys.GetVolume then
		maxcap = math.floor((phys:GetVolume()*volumeMul))
	end
	
	--add refined version of asteroid resources to storage
	local RD = CAF.GetAddon("Resource Distribution")
	
	--ent.caf.custom.resource = "steam";
	RD.RegisterNonStorageDevice(ent)

	local mass = maxcap/1000
	ent.mass = mass
	local maxhealth = 600
	return mass, maxhealth
end

TOOL.Devices = {
	seller_machine = {
		Name	= "Seller Machines",
		type	= "seller_machine",
		class	= "seller_machine",
		func	= seller_machine_func,

		devices = {
			seller_machine_main_store = {
				Name	= "Main Seller Machine",
				model	= "models/ce_ls3additional/fusion_generator/fusion_generator_huge.mdl",
				skin	= 0,
				free	= true,
				legacy	= false, --these two vars must be defined per ent as the old tanks (defined in external file) require different values
			},
		},
	},
	price_machine = {
		Name	= "Price Machines",
		type	= "price_machine",
		class	= "price_machine",
		func	= price_machine_func,

		devices = {
			price_machine_main_store = {
				Name	= "Price Outputter Machine",
				model	= "models/props_phx/life_support/gen_water.mdl",
				skin	= 0,
				free	= true,
				legacy	= false, --these two vars must be defined per ent as the old tanks (defined in external file) require different values
			},
		},
	},
}


	
	
	
